<ul class="accordion side-nav">
<?
	$usertype = $this->session->userdata('userType');
	if(strtolower($usertype) == 'student'){
		$this->load->view('layouts/_student_menu');
	}elseif($usertype == 'guardian'){
		$this->load->view('layouts/_guardian_menu');
	}else{
		//i have nothing
	}
?>
	<h3 class="head2 ui-corner-bottom side_menu">...</h3>
</ul>

<script>
	/*script for hiding the div*/
	$(document).ready(function(){

	    if ( Modernizr.touch )
	    {
	        
	    }else{
	        //class for saving menu cookies
	        var menu = {
	            setCookie : function(key, value) {
	                var expires = new Date();
	                expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
	                document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
	            },
	            getCookie : function(key) {
	                var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
	                return keyValue ? keyValue[2] : null;
	            }
	        }

	        // get current cookie
	        var cookie = menu.getCookie('varlochidsow');

	        //initialize menu
	        var init_menu = function(){
	            //if cookie is existing
	            if(cookie == 'hide'){
	            	$('a#hider').text('Show Sidebar');
	            	$("div.hidediv").hide();
	                $('div#content-views').removeClass('large-9').addClass('large-12');
	            }else{
	                //no saved cookie do not slide up the active
	                $("div.hidediv").show();
	                $('div#content-views').removeClass('large-12').addClass('large-9');
	            }
	        }

	        // initialize the hide up on page load
	        var dpc = setInterval(init_menu(), 1);
	        //break the set interval
	        clearInterval(dpc);
	    
			$('a#hider').on('click',function(e){
				e.preventDefault();
				
				menu.setCookie('varlochidsow','');
				
				$("div.hidediv").toggle({
					complete:function(){
						if($("div.hidediv").is(":visible") )
						{
							$('a#hider').text('Hide Sidebar');
							menu.setCookie('varlochidsow','nohide');
							$('div#content-views').removeClass('large-12').addClass('large-9');
						}else{
							$('a#hider').text('Show Sidebar');
							menu.setCookie('varlochidsow','hide');
							$('div#content-views').removeClass('large-9').addClass('large-12');
						}
					},
				});
			});
		}

		/*ajax counter for message and commendations*/
		$('.read_on_click').on('click',function(){
			var url = $(this).attr('data-url-id');

			$.ajax({
				url:url,
				type:'GET',
				data:[{update:true}]
			}).done(function(e){
				//uncomment to debug
				// console.log(e);
			});
		});
	});
</script>
